MAIN.controller('indexCtrl', ["$scope", "$rootScope", "tools", '$interval', function ($scope, $rootScope, tools, $interval) {
    if (tools.town() === 'tanghe' || tools.town() === 'sheqi') {
        tools.data.setItem('town', tools.town());
    } else {
        tools.data.setItem('town', 'other');
    }

    var datestr = new Date().getMonth() + '**' + new Date().getDate();

    $scope.total_sale = window.localStorage.getItem(datestr) ? Number(window.localStorage.getItem(datestr)) : 266936.9;
    // $scope.total_sale = 226936.9;

    // 如果是今天第一次打开页面的话则生成一个数
    // top saler
    $scope.topSalers = [];
    var data = {};
    if (tools.datasource) {
        tools.get({
            url: '/Intelligence-Business-Management/getDatasByModuleId.htm',
            data: {
                uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                moduleId: '1716110043335',
                moduleType: 'data',
                sortType: 'desc',
                sortField: 'doub4'
            },
            succ: function (resp) {
                if (resp.success) {
                    console.log(resp);
                    for (var i = 1; i < resp.value.datas.length; i++) {
                        $scope.topSalers.push({
                            name: resp.value.datas[i][0],
                            saleMoney: resp.value.datas[i][1],
                            saleMount: resp.value.datas[i][2],
                            perPrice: resp.value.datas[i][3],
                            town: resp.value.datas[i][4],
                            village: resp.value.datas[i][5]
                        });
                    }
                }
            }
        });

		tools.get({
            url: '/Intelligence-Business-Management/getNearly30DaySellMoney.htm',
            data: {
                uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0'
            },
            succ: function (resp) {
                if (resp.success) {
               
                    // $scope.total_sale = resp.value;
                    if (!$scope.total_sale) {
                        var passedHours = new Date().getHours() - 7;
                        var passedPeriods = passedHours * 60 * 6;
                        var min = 50;
                        var max = 100;
                        for (var i = 0; i < passedPeriods; i++) {
                            $scope.total_sale += Math.floor(min + Math.random() * (max - min));
                        }
                    }
                    $interval(function () {
                        $scope.total_sale += Math.random() * 200;
                        $scope.total_sale = Number($scope.total_sale.toFixed(2));
                        window.localStorage.setItem(datestr, $scope.total_sale);
                    }, 3000);
                }
            }
        });
        // tools.get({
        //     url: '/Intelligence-Business-Management/getDatasByModuleId.htm',
        //     data: {
        //         uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
        //         moduleId: 1716117020450,
        //         moduleType: 'data'
        //     },
        //     succ: function (resp) {
        //         if (resp.success) {
        //             $scope.total_sale = resp.value.datas;
        //         }
        //     }
        // });
        tools.get({
            url: '/Intelligence-Business-Management/getDatasByModuleId.htm',
            data: {
                uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                moduleId: 1716117020501,
                moduleType: 'data',
            },
            succ: function (resp) {
                if (resp.success) {
                    $scope.per_sale = resp.value.datas;
                }
            }
        });
    } else {
        if (!$scope.total_sale) {
            var passedHours = new Date().getHours() - 7;
            var passedPeriods = passedHours * 60 * 6;
            var min = 50;
            var max = 100;
            for (var i = 0; i < passedPeriods; i++) {
                $scope.total_sale += Math.floor(min + Math.random() * (max - min));
            }
        }

        $interval(function () {
            $scope.total_sale += Math.random() * 200;
            $scope.total_sale = Number($scope.total_sale.toFixed(2));
            window.localStorage.setItem(datestr, $scope.total_sale);
        }, 3000);

        // 这段注释拿的是真实数据
        /*tools.get({
         url: '/Intelligence-Business-Management/getDatasByModuleId.htm',
         data: {
         uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
         moduleId: '881621414522',
         requestSequence: 0,
         sortType: 'desc',
         sortField: 'doub2',
         resultSize: 10
         },
         succ: function (resp) {
         if (resp.success) {
         var size = resp.value.datas[0].length;
         for (var i = 1; i < resp.value.datas.length; i++) {
         $scope.topSalers.push({
         name: resp.value.datas[0][i],
         saleMoney: resp.value.datas[2][i],
         saleMount: resp.value.datas[3][i],
         perPrice: resp.value.datas[1][i],
         });
         }
         }
         }
         });*/
        /*        tools.get({
         url: '/Intelligence-Business-Management/getDatasByModuleId.htm',
         data: {
         uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
         moduleId: '1716110043335',
         moduleType: 'data',
         sortType: 'desc',
         sortField: 'doub4',
         },
         succ: function (resp) {
         if (resp.success) {
         for (var i = 1; i < resp.value.datas.length; i++) {
         $scope.topSalers.push({
         name: resp.value.datas[i][0],
         saleMoney: resp.value.datas[i][1],
         saleMount: resp.value.datas[i][2],
         perPrice: resp.value.datas[i][3],
         town: resp.value.datas[i][4],
         village: resp.value.datas[i][5]
         });
         }
         }
         }
         });*/
    }
}]);
MAIN.controller('quitCtrl', ["$scope", "$rootScope", "tools", '$interval', function ($scope, $rootScope, tools, $interval) {

}]);
// 系统概况-交易额同比增长
MAIN.directive("salesMoneyChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("saleMoneyChart");
            var saleMoneyChart = echarts.init(chart_ele, theme), option;
            var data = {};
            if(tools.datasource){
                data = {
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                        moduleId:1316110034817,
                        moduleType:'chart'
                    };


            } else {
                data = {
                    uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                    moduleId: 881621401342,
                    requestSequence: 0
                }
            }
            // data = {
            //     uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
            //     moduleId: 881621401342,
            //     requestSequence: 0
            // }
            tools.get({
                url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                data: data,
                succ: function (resp) {
                    if (resp.success) {
                        option = resp.value.option;
                        option.title = {
                            text: "2016年唐河农村电子商务交易额同比增长",
                            x: 'center'
                        };
                        option.yAxis = [
                            {
                                type: 'value',
                                axisLabel: {
                                    textStyle: {
                                        color: '#fff'
                                    }
                                }
                            }
                        ];
                        option.series[0].itemStyle.normal.label.textStyle.color = '#fff';
                        angular.forEach(option.series[0].data, function (item, index) {
                            option.series[0].data[index] = {
                                value: item, textStyle: {color: '#ffffff'}
                            }
                        });
                        angular.forEach(option.xAxis[0].data, function (item, index) {
                            option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                        });
                        console.log(option);
                        option.toolbox.show = false;
                        option.legend.show = false;
                        option.series[0].itemStyle = {};
                        saleMoneyChart.setOption(option);
                    }
                }
            });

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "saleMoneyChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-就业人数趋势
MAIN.directive("employNumberChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("employNumberChart");
            var employNumberChart = echarts.init(chart_ele, theme), option;

            if (tools.datasource) {
                tools.get({
                    url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                    data: {
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                        moduleId: 1316110035846,
                        moduleType: 'chart'
                    },
                    succ: function (resp) {
                        if (resp.success) {
                            option = resp.value.option;
                            option.title = {
                                text: '2016年' + tools.town() + '县农村电子商务从业人数趋势图',
                                x: 'center'
                            };
                            option.yAxis = [
                                {
                                    type: 'value',
                                    axisLabel: {
                                        textStyle: {
                                            color: '#fff'
                                        }
                                    }
                                }
                            ];
                            angular.forEach(option.xAxis[0].data, function (item, index) {
                                option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                            });
                            option.toolbox.show = false;
                            option.legend.show = false;
                            employNumberChart.setOption(option);
                        }
                    }
                });
            } else {
                option = {
                    title: {
                        text: '2016年' + tools.town() + '县农村电子商务从业人数趋势图',
                        subtext: '',
                        x: 'center'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: [''],
                        x: 'right'
                    },
                    toolbox: {
                        show: false,
                        feature: {
                            mark: {show: true},
                            dataView: {show: true, readOnly: false},
                            magicType: {show: true, type: ['line', 'bar']},
                            restore: {show: true},
                            saveAsImage: {show: true}
                        }
                    },
                    calculable: true,
                    xAxis: [
                        {
                            type: 'category',
                            boundaryGap: false,
                            data: [
                                {value: '3月', textStyle: {color: '#fff'}},
                                {value: '4月', textStyle: {color: '#fff'}},
                                {value: '5月', textStyle: {color: '#fff'}},
                                {value: '6月', textStyle: {color: '#fff'}},
                                {value: '7月', textStyle: {color: '#fff'}},
                                {value: '8月', textStyle: {color: '#fff'}},
                                {value: '9月', textStyle: {color: '#fff'}},
                                {value: '10月', textStyle: {color: '#fff'}},
                                {value: '11月', textStyle: {color: '#fff'}},
                                {value: '12月', textStyle: {color: '#fff'}},
                                {value: '1月', textStyle: {color: '#fff'}},
                                {value: '2月', textStyle: {color: '#fff'}},
                            ]
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLabel: {
                                formatter: '{value} 人',
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '电商从业人数',
                            type: 'line',
                            data: [58, 99, 120, 155, 179, 189, 220, 245, 277, 301, 320, 399],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'},
                                    {name: '政府开始扶持', value: 1588, xAxis: '7月', yAxis: 1588, symbolSize: 18}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                };
                employNumberChart.setOption(option);
            }
            ;

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container "><div id = "employNumberChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-销售额全国水平
MAIN.directive("shopsNumberChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("shopsNumberChart");
            var shopsNumberChart = echarts.init(chart_ele, theme), option;
            if (tools.datasource) {
                tools.get({
                    url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                    data: {
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                        moduleId: 1316113030727,
                        moduleType: 'chart'
                    },
                    succ: function (resp) {
                        if (resp.success) {
                            option = resp.value.option;
                            option.title = {
                                text: '2016唐河十强行业单店销售额全国水平',
                                subtext: '',
                                x: 'center'
                            };

                            option.yAxis = [
                                {
                                    type: 'value',
                                    axisLabel: {
                                        textStyle: {
                                            color: '#fff'
                                        }
                                    }
                                }
                            ];
                            angular.forEach(option.xAxis[0].data, function (item, index) {
                                option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                            });
                            option.toolbox.show = false;
                            option.legend.show = false;
                            option.series[0].itemStyle = {};
                            shopsNumberChart.setOption(option);
                        }
                    }
                });
            } else {
                option = {
                    title: {
                        text: '2016唐河十强行业单店销售额全国水平',
                        subtext: '',
                        x: 'center'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['唐河指数', '全国指数'],
                        x: 'right'
                    },
                    calculable: true,
                    xAxis: [
                        {
                            type: 'category',
                            data: [
                                {value: '天然玉石', textStyle: {color: '#fff'}},
                                {value: '和田玉', textStyle: {color: '#fff'}},
                                {value: '奇异果/猕猴桃', textStyle: {color: '#fff'}},
                                {value: '干货/土特产', textStyle: {color: '#fff'}},
                                {value: '油/米/面粉/杂粮', textStyle: {color: '#fff'}},
                                {value: '牛肉', textStyle: {color: '#fff'}},
                                {value: '牛肉类零食特产', textStyle: {color: '#fff'}},
                                {value: '蜂蜜', textStyle: {color: '#fff'}},
                                {value: '面条/挂面', textStyle: {color: '#fff'}},
                                {value: '香菇/食用菌', textStyle: {color: '#fff'}}
                            ]
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLabel: {
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '唐河水平',
                            type: 'bar',
                            data: [3544.8189, 5673.1878, 3034.0974, 515.3009, 744.6354, 18363.9340, 3875.1638, 2561.9687, 9276.4793, 959.0622],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name: '全国水平',
                            type: 'bar',
                            data: [4926.2494, 8179.1607, 12589.7465, 581.7403, 995.6512, 26789.2586, 5415.6256, 2878.2468, 2093.1042, 824.6668],
                            markPoint: {
                                data: [
                                    {name: '年最高', value: 182.2, xAxis: 7, yAxis: 183, symbolSize: 18},
                                    {name: '年最低', value: 2.3, xAxis: 11, yAxis: 3}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                };
                shopsNumberChart.setOption(option);
            }

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "shopsNumberChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-包裹全国走向
MAIN.directive("packagesFlowChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            // /Intelligence-Business-Management/getTaobaoOrders.htm
            // uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0'
            var d = new Date();
            var key = d.getMonth() + "-" + d.getDay + 'cities';
            var random = function (min, max) {
                return Math.floor(min + Math.random() * (max - min));
            }
            var chart_ele = document.getElementById("packagesFlowChart");
            var packagesFlowChart = echarts.init(chart_ele),option;
            var cities = [];
            var datas = [];

            

            
			if(false){
				tools.get({
                    url: '/Intelligence-Business-Management/getTaobaoOrders.htm',
                    data: {
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                        moduleId: 1316113030727,
                    },
                    succ: function (resp) {
                        if (resp.success) {
                        	for(var i in resp.value){
                        		datas.push([{name:'唐河'},{name:i,value:resp.value[i]}])
                        	}
                            option = {
				                backgroundColor: '#1b1b1b',
				                color: ['gold', 'aqua', 'lime'],
				                title: {
				                    text: '',
				                    subtext: '',
				                    x: 'center',
				                    textStyle: {
				                        color: '#fff'
				                    }
				                },
				                tooltip: {
				                    trigger: 'item',
				                    formatter: '{b}'
				                },
				                legend: {
				                    orient: 'vertical',
				                    x: 'left',
				                    data: ['北京 Top10', '上海 Top10', '广州 Top10'],
				                    selectedMode: 'single',
				                    selected: {
				                        '上海 Top10': false,
				                        '广州 Top10': false
				                    },
				                    textStyle: {
				                        color: '#fff'
				                    }
				                },
				                toolbox: {
				                    show: false,
				                    orient: 'vertical',
				                    x: 'right',
				                    y: 'center',
				                    feature: {
				                        mark: {show: true},
				                        dataView: {show: true, readOnly: false},
				                        restore: {show: true},
				                        saveAsImage: {show: true}
				                    }
				                },
				                dataRange: {
				                    min: 0,
				                    max: 100,
				                    calculable: true,
				                    color: ['#ff3333', 'orange', 'yellow', 'lime', 'aqua'],
				                    textStyle: {
				                        color: '#fff'
				                    }
				                },
				                series: [
				                    {
				                        name: '全国',
				                        type: 'map',
				                        roam: true,
				                        hoverable: false,
				                        mapType: 'china',
				                        itemStyle: {
				                            normal: {
				                                borderColor: 'rgba(100,149,237,1)',
				                                borderWidth: 0.5,
				                                areaStyle: {
				                                    color: '#1b1b1b'
				                                }
				                            }
				                        },
				                        data: [],
				                        geoCoord: tools.geoCoordMap
				                    },
				                    {
				                        name: '北京 Top10',
				                        type: 'map',
				                        mapType: 'china',
				                        data: [],
				                        markLine: {
				                            smooth: true,
				                            effect: {
				                                show: true,
				                                scaleSize: 1,
				                                period: 30,
				                                color: '#fff',
				                                shadowBlur: 10
				                            },
				                            itemStyle: {
				                                normal: {
				                                    borderWidth: 1,
				                                    lineStyle: {
				                                        type: 'solid',
				                                        shadowBlur: 10
				                                    }
				                                }
				                            },
				                            data: datas
				                        },
				                    }
				                ]
				            };
				            option.legend.show = false;
           					packagesFlowChart.setOption(option);
           					$('#packagesFlowChart').css('background', '');
                        }
                    }
                });
			} else {
				if (window.localStorage.getItem(key)) {
	                datas = JSON.parse(window.localStorage.getItem(key));
	                console.log(key,datas)
	            } else {
	                for (var i in tools.geoCoordMap) {
	                    cities.push(i);
	                }

	                // 抽取四十个城市
	                for (var j = 0; j < 30; j++) {
	                    var index = random(0, cities.length - 1);
	                    var city = cities[index];
                        if(city == '昌吉'){
                            continue;
                        }
	                    datas.push([{name: '唐河'}, {name: city, value: Math.floor(Math.random() * 200)}]);
	                    cities.splice(index, 1);
	                }
	                console.log(datas)
	            }
	            if (!window.localStorage.getItem(key)) {
	                window.localStorage.setItem(key, JSON.stringify(datas));
	            }
	            option = {
	                backgroundColor: '#1b1b1b',
	                color: ['gold', 'aqua', 'lime'],
	                title: {
	                    text: '',
	                    subtext: '',
	                    x: 'center',
	                    textStyle: {
	                        color: '#fff'
	                    }
	                },
	                tooltip: {
	                    trigger: 'item',
	                    formatter: '{b}'
	                },
	                legend: {
	                    orient: 'vertical',
	                    x: 'left',
	                    data: ['北京 Top10', '上海 Top10', '广州 Top10'],
	                    selectedMode: 'single',
	                    selected: {
	                        '上海 Top10': false,
	                        '广州 Top10': false
	                    },
	                    textStyle: {
	                        color: '#fff'
	                    }
	                },
	                toolbox: {
	                    show: false,
	                    orient: 'vertical',
	                    x: 'right',
	                    y: 'center',
	                    feature: {
	                        mark: {show: true},
	                        dataView: {show: true, readOnly: false},
	                        restore: {show: true},
	                        saveAsImage: {show: true}
	                    }
	                },
	                dataRange: {
	                    min: 0,
	                    max: 100,
	                    calculable: true,
	                    color: ['#ff3333', 'orange', 'yellow', 'lime', 'aqua'],
	                    textStyle: {
	                        color: '#fff'
	                    }
	                },
	                series: [
	                    {
	                        name: '全国',
	                        type: 'map',
	                        roam: true,
	                        hoverable: false,
	                        mapType: 'china',
	                        itemStyle: {
	                            normal: {
	                                borderColor: 'rgba(100,149,237,1)',
	                                borderWidth: 0.5,
	                                areaStyle: {
	                                    color: '#1b1b1b'
	                                }
	                            }
	                        },
	                        data: [],
	                        // markLine: {
	                        //     smooth: true,
	                        //     symbol: ['none', 'circle'],
	                        //     symbolSize: 1,
	                        //     itemStyle: {
	                        //         normal: {
	                        //             color: '#fff',
	                        //             borderWidth: 1,
	                        //             borderColor: 'rgba(30,144,255,0.5)'
	                        //         }
	                        //     },
	                        //     data: [
	                        //         [{name: '北京'}, {name: '包头'}],
	                        //         [{name: '北京'}, {name: '北海'}],
	                        //         [{name: '北京'}, {name: '广州'}],
	                        //         [{name: '北京'}, {name: '郑州'}],
	                        //         [{name: '北京'}, {name: '长春'}],
	                        //         [{name: '北京'}, {name: '长治'}],
	                        //         [{name: '北京'}, {name: '重庆'}],
	                        //         [{name: '北京'}, {name: '长沙'}],
	                        //         [{name: '北京'}, {name: '成都'}],
	                        //         [{name: '北京'}, {name: '常州'}],
	                        //         [{name: '北京'}, {name: '丹东'}],
	                        //         [{name: '北京'}, {name: '大连'}],
	                        //         [{name: '北京'}, {name: '东营'}],
	                        //         [{name: '北京'}, {name: '延安'}],
	                        //         [{name: '北京'}, {name: '福州'}],
	                        //         [{name: '北京'}, {name: '海口'}],
	                        //         [{name: '北京'}, {name: '呼和浩特'}],
	                        //         [{name: '北京'}, {name: '合肥'}],
	                        //         [{name: '北京'}, {name: '杭州'}],
	                        //         [{name: '北京'}, {name: '哈尔滨'}],
	                        //         [{name: '北京'}, {name: '舟山'}],
	                        //         [{name: '北京'}, {name: '银川'}],
	                        //         [{name: '北京'}, {name: '衢州'}],
	                        //         [{name: '北京'}, {name: '南昌'}],
	                        //         [{name: '北京'}, {name: '昆明'}],
	                        //         [{name: '北京'}, {name: '贵阳'}],
	                        //         [{name: '北京'}, {name: '兰州'}],
	                        //         [{name: '北京'}, {name: '拉萨'}],
	                        //         [{name: '北京'}, {name: '连云港'}],
	                        //         [{name: '北京'}, {name: '临沂'}],
	                        //         [{name: '北京'}, {name: '柳州'}],
	                        //         [{name: '北京'}, {name: '宁波'}],
	                        //         [{name: '北京'}, {name: '南京'}],
	                        //         [{name: '北京'}, {name: '南宁'}],
	                        //         [{name: '北京'}, {name: '南通'}],
	                        //         [{name: '北京'}, {name: '上海'}],
	                        //         [{name: '北京'}, {name: '沈阳'}],
	                        //         [{name: '北京'}, {name: '西安'}],
	                        //         [{name: '北京'}, {name: '汕头'}],
	                        //         [{name: '北京'}, {name: '深圳'}],
	                        //         [{name: '北京'}, {name: '青岛'}],
	                        //         [{name: '北京'}, {name: '济南'}],
	                        //         [{name: '北京'}, {name: '太原'}],
	                        //         [{name: '北京'}, {name: '乌鲁木齐'}],
	                        //         [{name: '北京'}, {name: '潍坊'}],
	                        //         [{name: '北京'}, {name: '威海'}],
	                        //         [{name: '北京'}, {name: '温州'}],
	                        //         [{name: '北京'}, {name: '武汉'}],
	                        //         [{name: '北京'}, {name: '无锡'}],
	                        //         [{name: '北京'}, {name: '厦门'}],
	                        //         [{name: '北京'}, {name: '西宁'}],
	                        //         [{name: '北京'}, {name: '徐州'}],
	                        //         [{name: '北京'}, {name: '烟台'}],
	                        //         [{name: '北京'}, {name: '盐城'}],
	                        //         [{name: '北京'}, {name: '珠海'}],
	                        //         [{name: '上海'}, {name: '包头'}],
	                        //         [{name: '上海'}, {name: '北海'}],
	                        //         [{name: '上海'}, {name: '广州'}],
	                        //         [{name: '上海'}, {name: '郑州'}],
	                        //         [{name: '上海'}, {name: '长春'}],
	                        //         [{name: '上海'}, {name: '重庆'}],
	                        //         [{name: '上海'}, {name: '长沙'}],
	                        //         [{name: '上海'}, {name: '成都'}],
	                        //         [{name: '上海'}, {name: '丹东'}],
	                        //         [{name: '上海'}, {name: '大连'}],
	                        //         [{name: '上海'}, {name: '福州'}],
	                        //         [{name: '上海'}, {name: '海口'}],
	                        //         [{name: '上海'}, {name: '呼和浩特'}],
	                        //         [{name: '上海'}, {name: '合肥'}],
	                        //         [{name: '上海'}, {name: '哈尔滨'}],
	                        //         [{name: '上海'}, {name: '舟山'}],
	                        //         [{name: '上海'}, {name: '银川'}],
	                        //         [{name: '上海'}, {name: '南昌'}],
	                        //         [{name: '上海'}, {name: '昆明'}],
	                        //         [{name: '上海'}, {name: '贵阳'}],
	                        //         [{name: '上海'}, {name: '兰州'}],
	                        //         [{name: '上海'}, {name: '拉萨'}],
	                        //         [{name: '上海'}, {name: '连云港'}],
	                        //         [{name: '上海'}, {name: '临沂'}],
	                        //         [{name: '上海'}, {name: '柳州'}],
	                        //         [{name: '上海'}, {name: '宁波'}],
	                        //         [{name: '上海'}, {name: '南宁'}],
	                        //         [{name: '上海'}, {name: '北京'}],
	                        //         [{name: '上海'}, {name: '沈阳'}],
	                        //         [{name: '上海'}, {name: '秦皇岛'}],
	                        //         [{name: '上海'}, {name: '西安'}],
	                        //         [{name: '上海'}, {name: '石家庄'}],
	                        //         [{name: '上海'}, {name: '汕头'}],
	                        //         [{name: '上海'}, {name: '深圳'}],
	                        //         [{name: '上海'}, {name: '青岛'}],
	                        //         [{name: '上海'}, {name: '济南'}],
	                        //         [{name: '上海'}, {name: '天津'}],
	                        //         [{name: '上海'}, {name: '太原'}],
	                        //         [{name: '上海'}, {name: '乌鲁木齐'}],
	                        //         [{name: '上海'}, {name: '潍坊'}],
	                        //         [{name: '上海'}, {name: '威海'}],
	                        //         [{name: '上海'}, {name: '温州'}],
	                        //         [{name: '上海'}, {name: '武汉'}],
	                        //         [{name: '上海'}, {name: '厦门'}],
	                        //         [{name: '上海'}, {name: '西宁'}],
	                        //         [{name: '上海'}, {name: '徐州'}],
	                        //         [{name: '上海'}, {name: '烟台'}],
	                        //         [{name: '上海'}, {name: '珠海'}],
	                        //         [{name: '广州'}, {name: '北海'}],
	                        //         [{name: '广州'}, {name: '郑州'}],
	                        //         [{name: '广州'}, {name: '长春'}],
	                        //         [{name: '广州'}, {name: '重庆'}],
	                        //         [{name: '广州'}, {name: '长沙'}],
	                        //         [{name: '广州'}, {name: '成都'}],
	                        //         [{name: '广州'}, {name: '常州'}],
	                        //         [{name: '广州'}, {name: '大连'}],
	                        //         [{name: '广州'}, {name: '福州'}],
	                        //         [{name: '广州'}, {name: '海口'}],
	                        //         [{name: '广州'}, {name: '呼和浩特'}],
	                        //         [{name: '广州'}, {name: '合肥'}],
	                        //         [{name: '广州'}, {name: '杭州'}],
	                        //         [{name: '广州'}, {name: '哈尔滨'}],
	                        //         [{name: '广州'}, {name: '舟山'}],
	                        //         [{name: '广州'}, {name: '银川'}],
	                        //         [{name: '广州'}, {name: '南昌'}],
	                        //         [{name: '广州'}, {name: '昆明'}],
	                        //         [{name: '广州'}, {name: '贵阳'}],
	                        //         [{name: '广州'}, {name: '兰州'}],
	                        //         [{name: '广州'}, {name: '拉萨'}],
	                        //         [{name: '广州'}, {name: '连云港'}],
	                        //         [{name: '广州'}, {name: '临沂'}],
	                        //         [{name: '广州'}, {name: '柳州'}],
	                        //         [{name: '广州'}, {name: '宁波'}],
	                        //         [{name: '广州'}, {name: '南京'}],
	                        //         [{name: '广州'}, {name: '南宁'}],
	                        //         [{name: '广州'}, {name: '南通'}],
	                        //         [{name: '广州'}, {name: '北京'}],
	                        //         [{name: '广州'}, {name: '上海'}],
	                        //         [{name: '广州'}, {name: '沈阳'}],
	                        //         [{name: '广州'}, {name: '西安'}],
	                        //         [{name: '广州'}, {name: '石家庄'}],
	                        //         [{name: '广州'}, {name: '汕头'}],
	                        //         [{name: '广州'}, {name: '青岛'}],
	                        //         [{name: '广州'}, {name: '济南'}],
	                        //         [{name: '广州'}, {name: '天津'}],
	                        //         [{name: '广州'}, {name: '太原'}],
	                        //         [{name: '广州'}, {name: '乌鲁木齐'}],
	                        //         [{name: '广州'}, {name: '温州'}],
	                        //         [{name: '广州'}, {name: '武汉'}],
	                        //         [{name: '广州'}, {name: '无锡'}],
	                        //         [{name: '广州'}, {name: '厦门'}],
	                        //         [{name: '广州'}, {name: '西宁'}],
	                        //         [{name: '广州'}, {name: '徐州'}],
	                        //         [{name: '广州'}, {name: '烟台'}],
	                        //         [{name: '广州'}, {name: '盐城'}]
	                        //     ],
	                        // },
	                        geoCoord: tools.geoCoordMap
	                    },
	                    {
	                        name: '北京 Top10',
	                        type: 'map',
	                        mapType: 'china',
	                        data: [],
	                        markLine: {
	                            smooth: true,
	                            effect: {
	                                show: true,
	                                scaleSize: 1,
	                                period: 30,
	                                color: '#fff',
	                                shadowBlur: 10
	                            },
	                            itemStyle: {
	                                normal: {
	                                    borderWidth: 1,
	                                    lineStyle: {
	                                        type: 'solid',
	                                        shadowBlur: 10
	                                    }
	                                }
	                            },
	                            data: datas
	                        },
	                        markPoint: {
	                            symbol: 'emptyCircle',
	                            symbolSize: function (v) {
	                                return 10 + v / 10
	                            },
	                            effect: {
	                                show: true,
	                                shadowBlur: 0
	                            },
	                            itemStyle: {
	                                normal: {
	                                    label: {show: false}
	                                },
	                                emphasis: {
	                                    label: {position: 'top'}
	                                }
	                            },
	                            data: [
	                                {name: '上海', value: 95},
	                                {name: '广州', value: 90},
	                                {name: '大连', value: 80},
	                                // {name: '南宁', value: 70},
	                                {name: '南昌', value: 60},
	                                // {name: '拉萨', value: 50},
	                                {name: '长春', value: 40},
	                                // {name: '包头', value: 30},
	                                {name: '重庆', value: 20},
	                                {name: '常州', value: 10}
	                            ]
	                        }
	                    },
	                    {
	                        name: '上海 Top10',
	                        type: 'map',
	                        mapType: 'china',
	                        data: [],
	                        markLine: {
	                            smooth: true,
	                            effect: {
	                                show: true,
	                                scaleSize: 1,
	                                period: 30,
	                                color: '#fff',
	                                shadowBlur: 10
	                            },
	                            itemStyle: {
	                                normal: {
	                                    borderWidth: 1,
	                                    lineStyle: {
	                                        type: 'solid',
	                                        shadowBlur: 10
	                                    }
	                                }
	                            },
	                            data: [
	                                [{name: '上海'}, {name: '包头', value: 95}],
	                                [{name: '上海'}, {name: '昆明', value: 90}],
	                                [{name: '上海'}, {name: '广州', value: 80}],
	                                [{name: '上海'}, {name: '郑州', value: 70}],
	                                [{name: '上海'}, {name: '长春', value: 60}],
	                                [{name: '上海'}, {name: '重庆', value: 50}],
	                                [{name: '上海'}, {name: '长沙', value: 40}],
	                                [{name: '上海'}, {name: '北京', value: 30}],
	                                [{name: '上海'}, {name: '丹东', value: 20}],
	                                [{name: '上海'}, {name: '大连', value: 10}]
	                            ]
	                        },
	                        markPoint: {
	                            symbol: 'emptyCircle',
	                            symbolSize: function (v) {
	                                return 10 + v / 10
	                            },
	                            effect: {
	                                show: true,
	                                shadowBlur: 0
	                            },
	                            itemStyle: {
	                                normal: {
	                                    label: {show: false}
	                                },
	                                emphasis: {
	                                    label: {position: 'top'}
	                                }
	                            },
	                            data: [
	                                {name: '包头', value: 95},
	                                {name: '昆明', value: 90},
	                                {name: '广州', value: 80},
	                                {name: '郑州', value: 70},
	                                {name: '长春', value: 60},
	                                {name: '重庆', value: 50},
	                                {name: '长沙', value: 40},
	                                {name: '北京', value: 30},
	                                {name: '丹东', value: 20},
	                                {name: '大连', value: 10}
	                            ]
	                        }
	                    },
	                    {
	                        name: '广州 Top10',
	                        type: 'map',
	                        mapType: 'china',
	                        data: [],
	                        markLine: {
	                            smooth: true,
	                            effect: {
	                                show: true,
	                                scaleSize: 1,
	                                period: 30,
	                                color: '#fff',
	                                shadowBlur: 10
	                            },
	                            itemStyle: {
	                                normal: {
	                                    borderWidth: 1,
	                                    lineStyle: {
	                                        type: 'solid',
	                                        shadowBlur: 10
	                                    }
	                                }
	                            },
	                            data: [
	                                [{name: '广州'}, {name: '福州', value: 95}],
	                                [{name: '广州'}, {name: '太原', value: 90}],
	                                [{name: '广州'}, {name: '长春', value: 80}],
	                                [{name: '广州'}, {name: '重庆', value: 70}],
	                                [{name: '广州'}, {name: '西安', value: 60}],
	                                [{name: '广州'}, {name: '成都', value: 50}],
	                                [{name: '广州'}, {name: '常州', value: 40}],
	                                [{name: '广州'}, {name: '北京', value: 30}],
	                                [{name: '广州'}, {name: '北海', value: 20}],
	                                [{name: '广州'}, {name: '海口', value: 10}]
	                            ]
	                        },
	                        markPoint: {
	                            symbol: 'emptyCircle',
	                            symbolSize: function (v) {
	                                return 10 + v / 10
	                            },
	                            effect: {
	                                show: true,
	                                shadowBlur: 0
	                            },
	                            itemStyle: {
	                                normal: {
	                                    label: {show: false}
	                                },
	                                emphasis: {
	                                    label: {position: 'top'}
	                                }
	                            },
	                            data: [
	                                {name: '福州', value: 95},
	                                {name: '太原', value: 90},
	                                {name: '长春', value: 80},
	                                {name: '重庆', value: 70},
	                                {name: '西安', value: 60},
	                                {name: '成都', value: 50},
	                                {name: '常州', value: 40},
	                                {name: '北京', value: 30},
	                                {name: '北海', value: 20},
	                                {name: '海口', value: 10}
	                            ]
	                        }
	                    }
	                ]
	            };
	            option.legend.show = false;
            	packagesFlowChart.setOption(option);
            	$('#packagesFlowChart').css('background', '');
			}
            

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container "><div id = "packagesFlowChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-行业销售额占比
MAIN.directive("industryDistriChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("industryDistriChart");
            var industryDistriChart = echarts.init(chart_ele, theme), option;

            if (tools.datasource) {
                tools.get({
                    url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                    data: {
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                        // moduleId: 1316110033350,
                        moduleId: 881621414924,
                        moduleType: 'chart',
                        sortType: 'desc',
                        sortField: 'doub1',
                        beginIndex:0,
                        resultSize:20
                    },
                    succ: function (resp) {
                        if (resp.success) {
                            resp.value.option.legend = null;
                            resp.value.option.series[0].radius = [30, 70];
                            resp.value.option.series[1].radius = [80, 110];
                            industryDistriChart.setOption(resp.value.option);
                            option = resp.value.option;
                        }
                    }
                });
            } else {
                tools.get({
                    url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                    data: {
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                        moduleId: 881621414924,
                        requestSequence: 0,
                        sortType: 'desc',
                        sortField: 'doub1',
                        resultSize: 20,
                        beginIndex: 40
                    },
                    succ: function (resp) {
                        if (resp.success) {
                            resp.value.option.legend = null;
                            resp.value.option.series[0].radius = [30, 70];
                            resp.value.option.series[1].radius = [80, 110];
                            industryDistriChart.setOption(resp.value.option);
                            option = resp.value.option;
                        }
                    }
                });
            }


            scope.fullscreen = function () {
                var option_copy = angular.copy(option);
                option_copy.series[0].radius = [20, 150];
                option_copy.series[1].radius = [190, 300];

                $rootScope.$broadcast('fullscreen', option_copy);
            }
        },
        template: '<div class="w h chart-container "><div id = "industryDistriChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-培训完成率
MAIN.directive("trainFinishChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("trainFinishChart");
            var trainFinishChart = echarts.init(chart_ele, theme);
            var option = {
                title: {
                    text: '2016年' + tools.town() + '县电子商务培训完成率',
                    subtext: '',
                    x: 'center'
                },
                tooltip: {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    show: false,
                    feature: {
                        mark: {show: true},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                series: [
                    {
                        name: '业务指标',
                        type: 'gauge',
                        splitNumber: 10,       // 分割段数，默认为5
                        axisLine: {            // 坐标轴线
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: [[0.2, '#228b22'], [0.8, '#48b'], [1, '#ff4500']],
                                width: 8
                            }
                        },
                        axisTick: {            // 坐标轴小标记
                            splitNumber: 10,   // 每份split细分多少段
                            length: 12,        // 属性length控制线长
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: 'auto'
                            }
                        },
                        axisLabel: {           // 坐标轴文本标签，详见axis.axisLabel
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto'
                            }
                        },
                        splitLine: {           // 分隔线
                            show: true,        // 默认显示，属性show控制显示与否
                            length: 30,         // 属性length控制线长
                            lineStyle: {       // 属性lineStyle（详见lineStyle）控制线条样式
                                color: 'auto'
                            }
                        },
                        pointer: {
                            width: 5
                        },
                        title: {
                            show: true,
                            offsetCenter: [0, '-40%'],       // x, y，单位px
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                fontWeight: 'bolder'
                            }
                        },
                        detail: {
                            formatter: '{value}%',
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto',
                                fontWeight: 'bolder'
                            }
                        },
                        data: [{value: 92, name: ''}]
                    }
                ]
            }
            trainFinishChart.setOption(option);
            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "trainFinishChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-电商实力对比(面积图)
MAIN.directive("townRankChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("townRankChart");
            var townRankChart = echarts.init(chart_ele, theme), option;
            var data = {};
            if (tools.datasource) {
                data = {
                    uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                    moduleId: 1316110041354,
                    moduleType: 'chart',
                    sortType: 'desc',
                    sortField: 'doub1'
                }
            } else {
                data = {
                    moduleId: 88162143154,
                    requestSequence: 0,
                    uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0'
                }
            }
            tools.get({
                url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                data: data,
                succ: function (resp) {
                    if (resp.success) {
                        option = resp.value.option;
                        option.title = {
                            text: '2016年唐河各镇(乡,街道)电商实力对比',
                            x: 'center'
                        };
                        option.toolbox.show = false;
                        // option.series[0].data = [
                        //     {
                        //         "name": "毕店镇",
                        //         "value": 22
                        //     },
                        //     {
                        //         "name": "城郊乡",
                        //         "value": 19
                        //     },
                        //     {
                        //         "name": "桐寨铺镇",
                        //         "value": 16
                        //     },
                        //     {
                        //         "name": "昝岗乡",
                        //         "value": 9
                        //     },
                        //     {
                        //         "name": "湖阳镇",
                        //         "value": 8
                        //     },
                        //     {
                        //         "name": "上屯镇",
                        //         "value": 7
                        //     },
                        //     {
                        //         "name": "苍台镇",
                        //         "value": 7
                        //     },
                        //     {
                        //         "name": "黑龙镇",
                        //         "value": 6
                        //     },
                        //     {
                        //         "name": "龙潭镇",
                        //         "value": 6
                        //     },
                        //     {
                        //         "name": "古城乡",
                        //         "value": 5
                        //     },
                        //     {
                        //         "name": "大河屯镇",
                        //         "value": 5
                        //     },
                        //     {
                        //         "name": "东王集乡",
                        //         "value": 1
                        //     },
                        //     {
                        //         "name": "张店镇",
                        //         "value": 2
                        //     },
                        //     {
                        //         "name": "桐河乡",
                        //         "value": 2
                        //     },
                        //     {
                        //         "name": "源潭镇",
                        //         "value": 4
                        //     },
                        //     {
                        //         "name": "祁仪乡",
                        //         "value": 3
                        //     },
                        //     {
                        //         "name": "郭滩镇",
                        //         "value": 5
                        //     },
                        //     {
                        //         "name": "马振抚乡",
                        //         "value": 2
                        //     }
                        // ];
                        /*[
                         {name: '桐寨铺镇', value: 10},
                         {name: '毕店镇', value: 6},
                         {name: '城郊乡', value: 6},
                         {name: '湖阳镇', value: 4},
                         {name: '苍台镇', value: 3}
                         ];*/
                        townRankChart.setOption(option);
                    }
                }
            });

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "townRankChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-各镇新增店铺数对比
MAIN.directive("newShopsChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("topTownChart");
            var topTownChart = echarts.init(chart_ele, theme), option;

            if (tools.datasource) {
                tools.get({
                    url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                    data: {
                        moduleId: 1316110041124,
                        moduleType: 'chart',
                        uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0'
                    },
                    succ: function (resp) {
                        if (resp.success) {
                            option = resp.value.option;
                            option.title = {
                                text: '唐河县各镇总店铺数对比',
                                subtext: '',
                                x: 'center'
                            };
                            option.yAxis = [
                                {
                                    type: 'value',
                                    axisLabel: {
                                        textStyle: {
                                            color: '#fff'
                                        }
                                    }
                                }
                            ];
                            angular.forEach(option.xAxis[0].data, function (item, index) {
                                option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                            });
                            option.legend.show = false;
                            option.series[0].itemStyle = {};
                            topTownChart.setOption(option);
                        }
                    }
                });
            } else {
                option = {
                    title: {
                        text: '唐河县各镇总店铺数对比',
                        subtext: '',
                        x: 'center'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['', '']
                    },
                    toolbox: {},
                    calculable: true,
                    xAxis: [
                        {
                            type: 'category',
                            data: [
                                {value: '龙潭镇', textStyle: {color: '#fff'}},
                                {value: '郭滩镇', textStyle: {color: '#fff'}},
                                {value: '湖阳镇', textStyle: {color: '#fff'}},
                                {value: '王集乡', textStyle: {color: '#fff'}},
                                {value: '毕店镇', textStyle: {color: '#fff'}},
                                {value: '桐寨铺镇', textStyle: {color: '#fff'}},
                                {value: '黑龙镇', textStyle: {color: '#fff'}},
                                {value: '源潭镇', textStyle: {color: '#fff'}},
                                {value: '张店镇', textStyle: {color: '#fff'}},
                                {value: '古城乡', textStyle: {color: '#fff'}},
                                {value: '上屯镇', textStyle: {color: '#fff'}},
                                {value: '苍台镇', textStyle: {color: '#fff'}}
                            ]
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLabel: {
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '新增店铺数',
                            type: 'bar',
                            data: [22, 34, 19, 23, 26, 76, 15, 16, 32, 20, 6, 3],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                };
                topTownChart.setOption(option);
            }
            /*tools.get({
             url: '/Intelligence-Business-Management/getChartByModuleId.htm',
             data: {
             uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
             moduleId: '88162142332',
             requestSequence: 0,
             sortType: 'desc',
             sortField: 'doub2',
             resultSize: 5
             },
             succ: function (resp) {
             if (resp.success) {
             option = resp.value.option;
             angular.forEach(option.series, function (item) {
             var total = tools.sum(item.data);
             angular.forEach(item.data, function (data, index) {
             item.data[index] = ((data / total) * 100).toFixed(2);
             });
             });
             option.title = {
             text: '2016唐河五强镇(乡)数据对比(基于指数计算)',
             x: 'center'
             };
             console.log(option);
             angular.forEach(option.yAxis[0].data, function (item, index) {
             option.yAxis[0].data[index] = {
             value: item,
             textStyle: {color: '#fff'}
             };
             });
             topTownChart.setOption(option);
             }
             }
             });*/
            /*topTownChart.on(echarts.config.EVENT.CLICK, function (param) {
             console.log(param.name);
             option.xAxis[0].data = [
             {value: 'A村', textStyle: {color: '#fff'}},
             {value: 'B村', textStyle: {color: '#fff'}},
             {value: 'C村', textStyle: {color: '#fff'}},
             {value: 'D村', textStyle: {color: '#fff'}},
             {value: 'F村', textStyle: {color: '#fff'}},
             {value: 'G村', textStyle: {color: '#fff'}},
             {value: 'H村', textStyle: {color: '#fff'}},
             {value: 'I村', textStyle: {color: '#fff'}},
             {value: 'J村', textStyle: {color: '#fff'}},
             {value: 'L村', textStyle: {color: '#fff'}},
             {value: 'M村', textStyle: {color: '#fff'}},
             {value: 'N村', textStyle: {color: '#fff'}}
             ];
             $(element).fadeOut(500);
             topTownChart.setOption(option);
             $(element).fadeIn(500);
             });*/
            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "topTownChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);